<!DOCTYPE HTML>
<%@page import="shop.vo.ProTypeBean"%>
<%@page import="shop.vo.UserBean"%>
<%@page import="shop.vo.CommentBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="shop.factory.DAOFactory"%>
<%@page import="java.util.List"%>
<%@page import="shop.vo.ProductBean"%>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/head.css" />
<link rel="stylesheet" type="text/css" href="../css/foot.css" />
<link rel="stylesheet" type="text/css" href="css/lookgood.css" />
<link rel="stylesheet" type="text/css" href="css/tab.css" />
<script src="../js/jquery-1.10.2.min.js" type="text/javascript"
	charset="utf-8"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jq.js" type="text/javascript" charset="utf-8"></script>

<!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<title>商品详情</title>
</head>
<%
	String str = (String)session.getAttribute("user");
	UserBean user1 = new UserBean();
	user1.setUser_name(str);
	int userid = DAOFactory.getIUserDAOInstance().findId(user1);
	ProductBean product = (ProductBean)session.getAttribute("pro");
	List<ProductBean> list = DAOFactory.getIProductDAOInstance().xiangqing(product);
	Iterator<ProductBean> it = list.iterator();
%>
<body>
	<nav class="navbar navbar-default" role="navigation">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target="#bs-example-navbar-collapse-1">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
		</div>
		<div class="collapse navbar-collapse"
			id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li class="active"><a href="../index.jsp">首页</a></li>
				<li><a href="<%=request.getContextPath() %>/OrderServlet?action=MyOrder"> <img src="../images/order.png" /> 我的订单
				</a></li>
				<li></li>
				<li><a href="<%=request.getContextPath() %>/OrderServlet?action=MyCart"> <img src="../images/car.png" /> 我的购物车
				</a></li>
				<li><a href="<%=request.getContextPath() %>/FavoriteServlet?action=MyFav"> <img src="../images/favorite.png" /> 我的收藏
				</a></li>
				<li><a href="<%=request.getContextPath() %>/AddressServlet?action=MyAddress"> <img src="../images/address.png" /> 我的地址簿
				</a></li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li><a href="<%=request.getContextPath() %>/UserServlet?action=xinxi"><span id="huanying">欢迎光临，游客</span></a></li>
				<li><a href="../Login/login.jsp">登陆</a></li>
				<li><a href="../Login/regist.jsp">注册</a></li>
				<li><a href="<%=request.getContextPath() %>/UserServlet?action=logout" class="active" onclick="return confirm('确认退出?')">退出</a></li>
			</ul>
		</div>
	</nav>
	<div class="container">
		<div class="row">
			<div class="col-lg-6">
				<img src="../images/logo.png" /> <span>只有你想不到，没有你买不到</span>
			</div>
			<div class="col-lg-6">
				<ul>
					<li><img src="../images/HEADERVIP1_gxf.png" /></li>
					<li><img src="../images/HEADERVIP2_k3d.png" /></li>
					<li><img src="../images/HEADERVIP3_wzf.png" /></li>
				</ul>
				<div class="mag_position">
					<img src="../images/quality.png" />
				</div>
			</div>
		</div>
	</div>

	<!--导航开始-->
	<div class="container-fluid nav-bg">
		<div class="navbar-default navbar-wrapper"
			id="bs-example-navbar-collapse-1">
			<div class=" navbar-header">
				<div class="container">
					<ul class="nav nav-pills" id="textcolor">
						<li class="active"><a href="../index.jsp">首页</a></li>
						<%
							List<Integer> list4 = DAOFactory.getIProTypeDAOInstance().listType();
							Iterator<Integer> it4 = list4.iterator();
							while (it4.hasNext()) {
								int b = it4.next();
								ProTypeBean ptype4 = DAOFactory.getIProTypeDAOInstance().find(b);
						%>
						<li><a href="<%=request.getContextPath()%>/ProductServlet?action=list&str=<%=ptype4.getPtype_name()%>"><%=ptype4.getPtype_name()%>专卖</a></li>
						<%
							}
						%>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!--导航结束-->
	
	<div class="container containerbg">
		<%
			if (it.hasNext()) {
				ProductBean product1 = it.next();
				int id = product1.getPro_id();
		%>
		<form action="<%=request.getContextPath()%>/ProductServlet?proID=<%=id %>" method="post">
		<input type="hidden" name="action" value="gou">
		<div class="row">
			<div class="col-md-5">
				<div class="demo">
					<div class="zoom-section">
						<div class="zoom-small-image">
							<a href='../<%=product1.getPro_img() %>' class='cloud-zoom' rel="position:'inside',showTitle:false,adjustX:-4,adjustY:-4">
								<img src="../<%=product1.getPro_litlleimg()%>"/>
							</a>
						</div>
					</div>
			<!--zoom-section end-->
				</div>
			</div>
			<!--商品图片+介绍开始-->
			<div class="col-md-7 gooddescription">
				<div id="prodname"><h2><%=product1.getPro_name() %></h2></div>
				<div class="page-header line"></div>
				<div class="pi_pro_price">
					<span class="pro_price">
						<i class="yuan">价格：￥</i>
						<em><%=product1.getPrice() %></em>
					</span>
				</div>  
				
				<div class="pro_priceForm"> 
					<div class="pro_description">
						<span class="title">商品描述：</span>
						<span class="description">
							<%=product1.getPro_description() %>
						</span>
					</div>
					<div class="pro_num">
						<span class="title">现库存：</span>
						<span class="num">
							<%=product1.getNum() %>
						</span>
						<span class="title">件</span>
					</div>
					<div class="addproduct">
						<span id="addcart">
							<input type="submit" value="加入购物车" class="btn btn-success">
						</span>
						<span id="addfav">
							<a href="<%=request.getContextPath() %>/FavoriteServlet?action=addFav&proId=<%=id%>" class="btn btn-warning">加入收藏夹</a>
						</span>
					</div>
				</div>
			</div> 
			<!--商品图片+介绍结束-->   
			  
			 <!--选项卡开始--> 
			<div class="col-md-12">
				<div class="page-header"></div>
				<div id="box">
					<ul id="tab_nav">
						<li><a href="#t_1">商品简介</a>
						</li>
						<li><a href="#t_2">商品保证</a>
						</li>
						<li><a href="#t_3">商品评价</a>
						</li>
					</ul>
					<div id="tab_content">
						<div id="t_1"><%=product1.getPro_description() %></div>
						<div id="t_2"><%=product1.getPro_param() %></div>
						<div id="t_3">
						<%
							CommentBean com = new CommentBean();
							com.setPro_id(id);
							List<CommentBean> find = DAOFactory.getICommentDAOInstance().findCom(com);
							Iterator<CommentBean> itCom = find.iterator();
							while (itCom.hasNext()) {
								CommentBean comment = itCom.next();
								UserBean user = comment.getUser();
						%>
							<p class="username">顾客名称：<%=user.getUser_name() %></p>
							<p class="content">评价内容：<%=comment.getCom_content() %></p>
							<p class="contentline"></p>
						<%
							}
						%>
							
						</div>
					</div>
				</div>
			</div>
			<!--选项卡结束-->
		</div>
		</form>
		
		<%
			}
		%>
		
	</div>
	
	<!--尾部开始-->
	<div class="container-fluid container-bg">
			<div class="row">
				<div class="col-md-3 foot-img">
					<img src="../images/logo.png" class="image_logo" />
				</div>
				<div class="col-md-3"> 
					<h4 class="page-header">我们的宗旨</h4>
					<p class="foot-word">把第一次购买的顾客变成终身顾客</p>
					<p class="foot-word">服务比销售更重要</p>
					<p class="foot-word">服务大众 诚信网商</p>
				</div>
				<div class="col-md-3"> 
					<h4 class="page-header">售后服务</h4>
					<p class="foot-word">
						<img src="../images/phone.png" />电话投诉：110</p>
					<p>
						<a href="#" class="btn btn-primary btn-success" data-toggle="modal" data-target="#myModal">客户反馈</a>
					</p>
				</div>
				<div class="col-md-3">
					<h4 class="page-header">联系我们</h4> 
					<p class="foot-word">
						<img src="../images/QQ.png" />QQ：118283513、102358974</p>
					<p class="foot-word">
						<img src="../images/phone.png" />电联：0668-8717664</p>
					<p class="foot-word">
						<img src="../images/weixin.png" />微信号：LH12150603</p>
				</div>
				<div class="col-lg-12 text-center">
					<p>友情链接：<a href="http://www.taobao.com">淘宝</a> <a href="http://www.tmall.com/">天猫</a>
						<a href="http://www.vip.com/">唯品会  </a><a href="http://www.jd.com/">京东</a>
						<a href="http://www.paipai.com/">拍拍网</a> <a href="http://www.mogujie.com/">蘑菇街</a>
						<br/> Power by Liang&Luo @版本号V0.0.01</p>
				</div>
			</div>
		</div>
 
		<div class="modal fade" id="myModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="z-index: 9999;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h3 class="page-header font_style" id="myModalLabel">请留下您宝贵的意见\(^o^)/~</h3>
					</div>
					<div class="modal-body">
						<form action="<%=request.getContextPath() %>/MessageServlet?userId=<%=userid %>" method="post">
						<textarea class="form-control" rows="3 " name="message"></textarea>
						<div class="modal-footer">
							<input class="btn btn-primary" type="submit" value="留言" />
							<input type="hidden" name="action" value="addMessage">
						</div>
					</form>
					</div>
				</div>
			</div>
		</div>
		<!--尾部结束-->
</body>
<script type="text/javascript">
<%
	String str0 = (String)session.getAttribute("user");
	if (session.getAttribute("user") != null) {
%>
document.getElementById("huanying").innerHTML = "欢迎光临，<%=str0%>";
<%
	} else {
%>
document.getElementById("huanying").innerHTML = "欢迎光临，游客";
<%
	}
%>
</script>
</html>